home *** CD-ROM | disk | FTP | other *** search
- /*
- * (c) Copyright 1992 by Panagiotis Tsirigotis
- * All rights reserved. The file named COPYRIGHT specifies the terms
- * and conditions for redistribution.
- */
-
- static char RCSid[] = "$Id: flags.c,v 5.1 1992/11/01 00:01:21 panos Exp $" ;
-
- #include "flags.h"
- #include "defs.h"
- #include "state.h"
-
- /*
- * Control flags
- */
- #define CF_NONE 0x0
- #define CF_RESTART 0x1
- #define CF_NOENV 0x2
-
- struct flag_action
- {
- int flag ;
- voidfunc action ;
- int control_flags ;
- } ;
-
-
- void soft_reconfig() ;
- void hard_reconfig() ;
- void dump_internal_state() ;
- void consistency_check() ;
- void child_exit() ;
- void server_retry() ;
- void quit_program() ;
- void terminate_program() ;
-
-
- static struct flag_action flag_actions[] =
- {
- { SOFT_RECONFIG_FLAG, soft_reconfig, CF_RESTART + CF_NOENV },
- { HARD_RECONFIG_FLAG, hard_reconfig, CF_RESTART + CF_NOENV },
- { RETRY_FLAG, server_retry, CF_RESTART },
- { DUMP_FLAG, dump_internal_state, CF_NONE },
- { TERMINATE_FLAG, terminate_program, CF_NONE },
- { CONSISTENCY_FLAG, consistency_check, CF_NONE },
- { CHILD_FLAG, child_exit, CF_RESTART },
- { QUIT_FLAG, quit_program, CF_NONE },
- { 0, 0, 0 }
- } ;
-
-
- int check_flags()
- {
- bool_int restart_loop = FALSE ;
- bool_int valid_env = ps.rws.env_is_valid ;
-
- while ( ! M_ARE_ALL_CLEAR( ps.flags ) )
- {
- register struct flag_action *fap ;
-
- for ( fap = flag_actions ; fap->flag != 0 ; fap++ )
- if ( M_IS_SET( ps.flags, fap->flag ) )
- {
- M_CLEAR( ps.flags, fap->flag ) ;
-
- if ( fap->control_flags & CF_NOENV )
- ps.rws.env_is_valid = FALSE ;
- else
- ps.rws.env_is_valid = valid_env ;
-
- (*fap->action)() ;
-
- if ( ! restart_loop )
- restart_loop = ( fap->control_flags & CF_RESTART ) ;
- break ;
- }
- }
-
- ps.rws.env_is_valid = valid_env ;
-
- return( restart_loop ) ;
- }
-
-
-